package spring.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/http1")
public class HttpDemoController {

    /**
     * 使用注入的方式向控制器中注入HttpServletRequest和HttpSession对象
     * @return
     */

@RequestMapping("/demo1")
    public String demo1(HttpServletRequest request, HttpSession session,HttpServletResponse response){
request.setAttribute("user_name","小包");
session.setAttribute("user_name","成都");

    return "/test1.jsp";
    }
}
